import axios from 'axios'
import { NEWLIST_GET } from '../actionTypes'
export const getNewsList = (id) => {
  const fn = async (dispatch) => {
    const res = await axios.get(
      `http://geek.itheima.net/v1_0/articles?channel_id=${id}&timestamp=${Date.now()}`
    )
    console.log('新闻列表', res)

    dispatch({ type: NEWLIST_GET, payload: res.data.data.results })
  }
  return fn
}
